package com.secsbrain.development.web.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.secsbrain.development.biz.constant.PublishProjectStatus;

import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

@JsonIgnoreProperties(ignoreUnknown = true)
public class PublishProjectDTO {
	private Long id;
	@NotEmpty
	private String projectName;
	private String env;
	private Long envId;

	private String creatorName;

	private String approverName;

	private String exectorName;

	private PublishProjectStatus status;

	private Date beginTime;

	private Date endTime;
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date createdTime;
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date updatedTime;
	@NotEmpty
	private String projectDesc;

	@NotEmpty
	@Valid
	private List<AppInfo> appList;
	private List<DeploymentDTO> needAssignServer;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}

	public String getEnv() {
		return env;
	}

	public void setEnv(String env) {
		this.env = env;
	}

	public Long getEnvId() {
		return envId;
	}

	public void setEnvId(Long envId) {
		this.envId = envId;
	}

	public String getCreatorName() {
		return creatorName;
	}

	public void setCreatorName(String creatorName) {
		this.creatorName = creatorName;
	}

	public String getApproverName() {
		return approverName;
	}

	public void setApproverName(String approverName) {
		this.approverName = approverName;
	}

	public String getExectorName() {
		return exectorName;
	}

	public void setExectorName(String exectorName) {
		this.exectorName = exectorName;
	}

	public PublishProjectStatus getStatus() {
		return status;
	}

	public void setStatus(PublishProjectStatus status) {
		this.status = status;
	}

	public Date getBeginTime() {
		return beginTime;
	}

	public void setBeginTime(Date beginTime) {
		this.beginTime = beginTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public Date getCreatedTime() {
		return createdTime;
	}

	public void setCreatedTime(Date createdTime) {
		this.createdTime = createdTime;
	}

	public Date getUpdatedTime() {
		return updatedTime;
	}

	public void setUpdatedTime(Date updatedTime) {
		this.updatedTime = updatedTime;
	}

	public String getProjectDesc() {
		return projectDesc;
	}

	public void setProjectDesc(String projectDesc) {
		this.projectDesc = projectDesc;
	}

	public List<AppInfo> getAppList() {
		return appList;
	}

	public void setAppList(List<AppInfo> appList) {
		this.appList = appList;
	}

	public List<DeploymentDTO> getNeedAssignServer() {
		return needAssignServer;
	}

	public void setNeedAssignServer(List<DeploymentDTO> needAssignServer) {
		this.needAssignServer = needAssignServer;
	}

	@JsonIgnoreProperties(ignoreUnknown = true)
	public static class AppInfo {
		@NotNull
		private Long id;
		private String appName;
		@NotEmpty
		private String branch;
		private String disconfVersion;

		public Long getId() {
			return id;
		}

		public void setId(Long id) {
			this.id = id;
		}

		public String getAppName() {
			return appName;
		}

		public void setAppName(String appName) {
			this.appName = appName;
		}

		public String getBranch() {
			return branch;
		}

		public void setBranch(String branch) {
			this.branch = branch;
		}

		public String getDisconfVersion() {
			return disconfVersion;
		}

		public void setDisconfVersion(String disconfVersion) {
			this.disconfVersion = disconfVersion;
		}

	}
}
